<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of EWebUser
 *
 * @author Erycson
 */
class EWebUser extends CWebUser
{

    protected $_model;

    // Load user model.
    protected function getUsuario()
    {
        if ($this->_model === null) {
            $this->_model = Usuario::model()->findByPk($this->id);
        }
        return $this->_model;
    }

    function isAdmin()
    {
        $model = $this->getUsuario();
        
        if ($model)
            return $model->perfil->nome == 'administrador';
        return false;
    }
	
	function isOrientador()
	{$model = $this->getUsuario();
        
        if ($model)
            return $model->perfil->nome == 'orientador';
        return false;
	
	}

    function isProfessor() {
        $model = $this->getUsuario();

        if($model) return $model->perfil->nome == 'professor';
        return false;
    }

    function isProfessorEstagio() {
        $model = $this->getUsuario();

        if($model) return $model->perfil->nome == 'administrador';
        return false;
    }

    function isAluno() {
      $model = $this->getUsuario();

      if($model) return $model->perfil->nome == 'aluno';
      return false;
    }

}
